//
//  RYDingdanDetailHead.swift
//  SheYangBigData
//
//  Created by 宋海胜 on 2021/1/14.
//  Copyright © 2021 叁拾叁. All rights reserved.
//

import UIKit

class RYDingdanDetailHead: SYBaseView {

    var sepView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = Constant.bgViewColor
        return v
    }()
    
    let bgView: UIImageView = {
        let v: UIImageView = UIImageView()
        v.image = UIImage(named: "daifukuan_bg")
        return v
    }()
    
    let location: RYLocationView = {
        let v: RYLocationView = RYLocationView()
        return v
    }()
    
    let statusLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor.white
        v.font = 18.autoBoldFontSize()
        v.text = "待付款"
        return v
    }()
    
    let shuomingLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor.white
        v.font = 12.autoBoldFontSize()
        v.text = "请在30分钟内完成支付，过时订单将会取消"
        return v
    }()
    
    let pay: UIButton = {
        let v: UIButton  = UIButton()
        v.setTitle("去支付", for: .normal)
        v.setTitleColor(UIColor(hex:0x367FF6), for: .normal)
        v.titleLabel?.font = 14.autoFontSize()
        v.layer.cornerRadius = 17.5.autoWidth()
        v.backgroundColor = UIColor.white
        return v
    }()
    
    let cancel: UIButton = {
        let v: UIButton  = UIButton()
        v.setTitle("取消订单", for: .normal)
        v.setTitleColor(UIColor.white, for: .normal)
        v.titleLabel?.font = 14.autoFontSize()
        v.layer.cornerRadius = 17.5.autoWidth()
//        v.backgroundColor = UIColor(hex:0x367FF6)
        v.layer.borderWidth = 1
        v.layer.borderColor = UIColor.white.cgColor
        return v
    }()
    
    func configure(_ model: RYDingdanModel) {
        location.configure(model)
    }

    override func initViews() {
        
        self.backgroundColor = .white
        addSubview(sepView)
        addSubview(bgView)
        bgView.addSubview(statusLb)
        bgView.addSubview(shuomingLb)
        bgView.addSubview(pay)
        bgView.addSubview(cancel)
        
        addSubview(location)
        
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(10.autoWidth())
            make.left.equalToSuperview().offset(15.autoWidth())
            make.right.equalToSuperview().offset(-15.autoWidth())
            make.height.equalTo(139.autoWidth())
        }
        statusLb.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(14.autoWidth())
            make.centerX.equalToSuperview()
            make.height.equalTo(18.autoWidth())
        }
        shuomingLb.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(48.autoWidth())
            make.centerX.equalToSuperview()
            make.height.equalTo(13.autoWidth())
        }
        pay.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(83.autoWidth())
            make.centerX.equalToSuperview().offset(-60.autoWidth())
            make.height.equalTo(35.autoWidth())
            make.width.equalTo(107.autoWidth())
        }
        cancel.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(83.autoWidth())
            make.centerX.equalToSuperview().offset(60.autoWidth())
            make.height.equalTo(35.autoWidth())
            make.width.equalTo(107.autoWidth())
        }
        location.snp.makeConstraints { (make) in
            make.top.equalTo(bgView.snp.bottom).offset(15.autoWidth())
            make.left.equalToSuperview().offset(15.autoWidth())
            make.right.equalToSuperview().offset(-15.autoWidth())
            make.bottom.equalToSuperview().offset(-27.autoWidth())
        }
        sepView.snp.makeConstraints { (make) in
            make.height.equalTo(10.autoWidth())
            make.left.equalToSuperview()
            make.right.equalToSuperview()
            make.bottom.equalToSuperview()
        }
    }

}
